<template>
	<view class="container">
		<view class="box">
			<text class="title">{{note.title}}</text>
			<text class="time">{{note.insert_time}}</text>
			<text class="content">{{note.content}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				note:{}
			};
		},
		onLoad(op) {
			this.get_sys_note(op.id)
		},
		methods:{
			// 获取系统通知
			get_sys_note(id){
				let self=this
				this.$u.api.get_sys_note_detail({
					id:id
				}).then(res=>{
					if(res.code==200){
						self.note=res.data
						self.note.content=self.deal_str(res.data.content) 
					}else{
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					}
				})
			},
			deal_str(str){
				var re1=/<p>/gi
				var re2=/<\/p>/gi
				var re3=/<br\/>/gi
				var ss=str.replace(re1,'').replace(re2,'\n').replace(re3,'')
				return ss
			}
			
		}
	}
</script>

<style lang="scss">
	.container{
		width: 100vw;
		height: 100vh;
		.box{
			display: flex;
			flex-direction: column;
			justify-content: flex-start;
			align-items: center;
			width: 100%;
			padding: 0rpx 10rpx;
			.title{
				padding: 50rpx 10rpx 45rpx 10rpx;
			}
			.time{
				width: 100%;
				padding: 0rpx 10rpx 10rpx 10rpx;
			}
			.content{
				width: 100%;
				border: 1px solid #F5F5F5;
				padding: 20rpx 10rpx;
			}
		}
	}
</style>
